<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>article left</title>
<link type="text/css" rel="stylesheet" href="/networkforum/css/article_left.css" />
<!–[if lt IE9]> 
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]–>
<script type="text/javascript">
window.onload = function(){
	var userId = window.parent.document.getElementById("userId").value;
	
	//登录页面后通过myajax获取进一步的信息
	var myajax = getByAjax();
	myajax.init(null,"get",true);
	myajax.get("/networkforum/article/article_left_init.do?userId="+userId,init);
	myajax = null;	
}
function init(d){
	//var data = eval("("+d+")");
	var data = toJson(d);
	userInfo(data.userInfo);
	groupInfo(data.groupInfo);
	readRankInfo(data.readRankInfo);
	replyRankInfo(data.replyRankInfo);
	lastReplyInfo(data.lastReplyInfo);
	hotUserInfo(data.hotUser);
	window.parent.iFrameHeight("leftIframe");
}
function userInfo(d){
	document.getElementById("targetId").value=d.userId;
	document.getElementById("userPhoto").src = d.userPhoto;
	document.getElementById("userName").innerHTML = d.userName;
	document.getElementById("score").innerHTML = "积分： "+d.userScore+"分";
	document.getElementById("rank").innerHTML = "排名： "+d.userRank+"名";
	document.getElementById("replyTime").innerHTML = "评论次数： "+d.replyTimes+"次";
	document.getElementById("visitTime").innerHTML = "访问次数： "+d.visitTimes+"次";
}
function groupInfo(d){
	var group = document.getElementById("groupInner");
	var frag = document.createDocumentFragment();
	for(var i =0;i<d.length;i++){
		var data = d[i];
		var li = document.createElement("li");
		li.innerHTML = data.articleGroupName+"("+data.articleNumber+")";
		frag.appendChild(li);
	}
	group.appendChild(frag);
}
function readRankInfo(d){
	var readRank = document.getElementById("readRankInner");
	var frag = document.createDocumentFragment();
	for(var i =0;i<d.length;i++){
		var data = d[i];
		var li = document.createElement("li");
		li.innerHTML = (i+1)+"."+data.articleTitle;
		frag.appendChild(li);
	}
	readRank.appendChild(frag);
}
function replyRankInfo(d){
	var replyRank = document.getElementById("replyRankInner");
	var frag = document.createDocumentFragment();
	for(var i =0;i<d.length;i++){
		var data = d[i];
		var li = document.createElement("li");
		li.innerHTML = (i+1)+"."+ data.articleTitle;
		frag.appendChild(li);
	}
	replyRank.appendChild(frag);
}
function lastReplyInfo(d){
	var lastReplys = document.getElementById("lastReplyInner");
	var frag = document.createDocumentFragment();
	for(var i =0;i<d.length;i++){
		var data = d[i];
		var li = document.createElement("li");
		li.innerHTML = data.userName+":"+data.replyContent;
		frag.appendChild(li);
	}
	lastReplys.appendChild(frag);
}
function hotUserInfo(d){
	var hotUser = window.parent.document.getElementById("hotUser");
	var frag = document.createDocumentFragment();
	for(var i =0;i<d.length;i++){
		var data = d[i];
		var li = document.createElement("li");
		var img = document.createElement("img");
		var name = document.createElement("label");

		img.userId = data.userId;
		img.src = data.userPhoto;
		name.innerHTML = data.userName;

		li.appendChild(img);
		li.appendChild(name);
		
		frag.appendChild(li);
	}
	hotUser.appendChild(frag);
}
</script>
</head>

<body>
	<input id="targetId" type="text" style="display: none;" value=""/>
	<section class="leftInner">
    	<section class="userInfo module">
        	<header>个人资料</header>
            <img id="userPhoto" src="../../images/left1.jpg" />
            <h4 id="userName">xunxun巡巡</h4>
            <section class="care">
	            <label onclick="leaveMessage('/networkforum/pages/message/message_main.html',window.parent.document.body);">留言</label>
            </section>
            <section class="articleData">
            	<label id="score">积分: 0次</label>
            	<label id="rank">排名: 0次</label>
            	<label id="replyTime">评论: 0次</label>
                <label id="visitTime">访问次数: 0次</label>
            </section>
        </section>
        <!-- <section class="articleSearch module">
        	<header>文章搜索</header>
			<input type="text"/>
            <label>搜索</label>
        </section> -->
        <section id="articleGroup" class="module">
        	<header>文章分类</header>
			<ul id="groupInner" class="inner">
			</ul>
        </section>
        <section id="readRank" class="module">
        	<header>阅读排行</header>
			<ul id="readRankInner" class="rank">
			</ul>
        </section>
        <section id="replyRank" class="module">
        	<header>评论排行</header>
			<ul id="replyRankInner" class="rank">
				
			</ul>
        </section>
        <section id="lastReplys" class="module">
        	<header>最新评论</header>
			<ul id="lastReplyInner" class="inner">
				
			</ul>
        </section>
    </section>
</body>
<script type="text/javascript" src="/networkforum/js/myajax.js"></script>
<script type="text/javascript" src="/networkforum/js/base.js"></script>
</html>
